# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BigtableAdmin.V2.Model.CreateTableRequest do
  @moduledoc """
  Request message for google.bigtable.admin.v2.BigtableTableAdmin.CreateTable

  ## Attributes

  *   `initialSplits` (*type:* `list(GoogleApi.BigtableAdmin.V2.Model.Split.t)`, *default:* `nil`) - The optional list of row keys that will be used to initially split the table into several tablets (tablets are similar to HBase regions). Given two split keys, `s1` and `s2`, three tablets will be created, spanning the key ranges: `[, s1), [s1, s2), [s2, )`. Example: * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",` `"other", "zz"]` * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]` * Key assignment: - Tablet 1 `[, apple) => {"a"}.` - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.` - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.` - Tablet 4 `[customer_2, other) => {"customer_2"}.` - Tablet 5 `[other, ) => {"other", "zz"}.`
  *   `table` (*type:* `GoogleApi.BigtableAdmin.V2.Model.Table.t`, *default:* `nil`) - Required. The Table to create.
  *   `tableId` (*type:* `String.t`, *default:* `nil`) - Required. The name by which the new table should be referred to within the parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`. Maximum 50 characters.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :initialSplits => list(GoogleApi.BigtableAdmin.V2.Model.Split.t()) | nil,
          :table => GoogleApi.BigtableAdmin.V2.Model.Table.t() | nil,
          :tableId => String.t() | nil
        }

  field(:initialSplits, as: GoogleApi.BigtableAdmin.V2.Model.Split, type: :list)
  field(:table, as: GoogleApi.BigtableAdmin.V2.Model.Table)
  field(:tableId)
end

defimpl Poison.Decoder, for: GoogleApi.BigtableAdmin.V2.Model.CreateTableRequest do
  def decode(value, options) do
    GoogleApi.BigtableAdmin.V2.Model.CreateTableRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BigtableAdmin.V2.Model.CreateTableRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
